package com.example.controller;

import com.example.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

@Controller
public class UserController3 {
    // 注⼊⽅法3: Setter⽅法注⼊
    private UserService userService;

    @Autowired // 标注在Setter方法上
    public void setUserService(UserService userService) {
        this.userService = userService;
    }

    public void hello() {
        System.out.println("hi,UserController3...");
        userService.hello();
    }
}
